/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.thienloc.omap.entity;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author GiangLT
 */
@Entity
@Table(name = "RAW_MO_COUNT", catalog = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "RawMoCount.findAll", query = "SELECT r FROM RawMoCount r"),
    @NamedQuery(name = "RawMoCount.findById", query = "SELECT r FROM RawMoCount r WHERE r.id = :id"),
    @NamedQuery(name = "RawMoCount.findByContent", query = "SELECT r FROM RawMoCount r WHERE r.content = :content"),
    @NamedQuery(name = "RawMoCount.countByContent", query = "SELECT SUM(r.count) FROM RawMoCount r WHERE r.content = :content and r.shortcode = :shortcode"),
    @NamedQuery(name = "RawMoCount.findByCount", query = "SELECT r FROM RawMoCount r WHERE r.count = :count")})
public class RawMoCount implements Serializable {
    @Size(max = 10)
    @Column(name = "SHORTCODE")
    private String shortcode;

    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ID")
    private Integer id;
    @Size(max = 400)
    @Column(name = "CONTENT")
    private String content;
    @Column(name = "COUNT")
    private Integer count;

    public RawMoCount() {
    }

    public RawMoCount(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public Integer getCount() {
        return count;
    }

    public void setCount(Integer count) {
        this.count = count;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof RawMoCount)) {
            return false;
        }
        RawMoCount other = (RawMoCount) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.thienloc.omap.entity.RawMoCount[ id=" + id + " ]";
    }

    public String getShortcode() {
        return shortcode;
    }

    public void setShortcode(String shortcode) {
        this.shortcode = shortcode;
    }
}
